<template>
    <div class="AccountBottom">
      <div class="a">
        <div class="bottom-top" @click="selectAllMusic">
          <span></span>
          <span>播放全部</span>
        </div>
      </div>
      <div class="bottom-bottom">
        <IscrollView>
          <songListItem :songs="switchNum ===0 ? favoriteList : historyList"></songListItem>
        </IscrollView>
      </div>
    </div>
</template>

<script>
import IscrollView from '../IscrollView'
import songListItem from '../songListItem'
import { mapGetters, mapActions, mapMutations } from 'vuex'
export default {
  name: 'AccountBottom',
  computed: {
    ...mapGetters([
      'favoriteList',
      'historyList'
    ])
  },
  components: {
    IscrollView,
    songListItem
  },
  methods: {
    ...mapActions([
      'setFullScreen',
      'setsongs',
      'setIndexs'
    ]),
    ...mapMutations([
      'setsongs'
    ]),
    selectAllMusic () {
      if (this.switchNum === 0) {
        this.setsongs(this.favoriteList)
      } else {
        this.setsongs(this.historyList)
      }
      this.setFullScreen(true)
      this.setIndexs(0)
    }
  },
  props: {
    switchNum: {
      type: Number,
      default: 0,
      required: true
    }
  }
}
</script>

<style scoped lang="scss">
  @import "../../assets/css/mixin";
  @import "../../assets/css/variable";
.AccountBottom{
  position: fixed;
  top: 100px;
  left: 0;
  right: 0;
  bottom: 0;
  /*background: skyblue;*/
  .a{
    width: 100%;
    @include bg_sub_color();
    .bottom-top{
      width: 260px;
      height: 60px;
      margin: 20px auto;
      @include bg_color();
      display: flex;
      justify-content: center;
      align-items: center;
      border: 1px solid #000;
      @include bg_sub_color();
      border-radius: 30px;
      padding: 0 20px;
      span{
        display: inline-block;
        &:nth-of-type(1){
          width: 46px;
          height: 46px;
          margin-right: 20px;
          @include bg_img('../../assets/images/small_play')
        }
        @include font_color();
        @include font_size($font_medium)
      }
    }
  }
  .bottom-bottom{
    position: fixed;
    top: 200px;
    left: 0;
    bottom: 0;
    right: 0;
    overflow: hidden;
    /*background: pink;*/
  }
}
</style>
